String Variable
The String variable lets you set a string value and perform methods on the variable. As string variable methods are called, the value of the string variable changes. For more information, see General Component Properties, Methods, and Events.
Properties
Name |
Description |
Encrypt |
Set this property to True to encrypt the value of the variable when the solution is saved. For more information, see Encrypt Property. |
Length |
The total number of characters and spaces included in the string variable. |
Value |
The current string assigned to the string variable. |
Methods
Name |
Description |
Parameters |
Result Type |
Append (1 param) |
Modifies the value of the variable by adding a text string to the end of the value. |
String parameter. The string to append. |
String result. Contains the initial string variable value with the value of the string parameter appended. |
Contains (1 param) |
Comparison method. Returns a True/False value based on whether a particular character or sequence of characters is located within initial value of the variable. |
String parameter. The string to which the value of the string variable is compared. |
Boolean. True if string value and parameter are equivalent. False otherwise. |
EndsWith (1 param) |
Comparison method. Returns a True/False value based on the match (parameter) value. The method applies to the current value of the variable in the case that multiple methods have been used to modify the original value. |
String parameter. The string to which the ending of the variable string is compared. |
Boolean. True if the parameter string is equivalent to the end of the variable string. |
IndexOf (1 param) |
Returns the index (position within the string) of the character supplied (parameter 1). This method reads the current value of the variable and returns the location of the first match found. |
Match - Character parameter for which the method searches. |
Integer - Represents the position in the string at which the parameter character is matched for the first time. |
IndexOf |
Returns the index (position within the string) of the character supplied (parameter 1). The method searches for a match starting in the position indicated by parameter 2. Note that the first position in the string has index 0. This method reads the current value of the variable and returns the location of the first match found on or after the starting position. |
Match - Character parameter for which the method searches. StartIndex - Integer parameter which denotes the location from which the search begins. |
Integer - Represents the position in the string at which the parameter character is matched for the first time.
|
IndexOf |
Returns the index (position within the string) of the character supplied (parameter 1). The method searches for a match starting in the position indicated by parameter 2 and ending at parameter 3. Note that the first position in the string has index 0. This method reads the current value of the variable and returns the location of the first match found on or after the starting position up to the ending position. |
Match - Character parameter for which the method searches. StartIndex - Integer parameter which denotes the location from which the search begins. Count - Integer parameter which denotes the number of character positions, following the start index, which are to be searched. |
Integer - Represents the position in the string at which the parameter character is matched for the first time.
|
Insert |
This method creates a new string value which is a combination of the original variable string plus the new text (param 1) inserted at the specified position (param 2) in the string. |
Integer - StartIndex Position at which the new string (stringvalue parameter) is inserted in the variable string. String - StringValue. The string to be inserted in the string variable. |
String. Result contains the original value of the string variable and the value of the stringvalue parameter inserted at the designated start index position parameter.
|
IsRegexMatch |
This method determines if the given Regex expression (Expression parameter) is matched within the string variable value. |
String - Expression. The Regex expression for which a match is sought. |
Boolean. True result of the Expression is matched in the string variable value. Otherwise, False is returned. |
Join (2 params) |
This method reads the contents of a string array (val) and joins all of array items. By entering a sep value, you can insert a string or character at the places at which strings are joined. The sep value can be omitted to have no separation indicators in the result string. For example, if the array contains the following:
and you enter “-“ as the sep value, the resulting string would be: abc-def-ghi. |
String - Sep The “Sep” represents the character or string of characters that denotes the separation point of strings within the input array. String array - stringList. The source of string values to be joined. |
String representing the concatenation of the array (val) strings and the separation identifier (sep) |
Join (4 params) |
This method reads the contents of a string array (val), beginning the item indicated by the First parameter and ending after the number of items indicated by the Count parameter. For the items from the First position and included in the Count, the method joins the array items. By entering a sep value, you can insert a string or character at the places at which strings are joined. Note that the array contents are counted from 0 (the first item in the array is at location 0). The sep value can be omitted to have no separation indicators in the result string. For example, if the array contains the following:
and you enter “-“ as the sep value, 1 as the First, and 2 as the count, the resulting string would be: def-ghi. |
String - Sep. Parameter represents the character or string of characters that denotes the separation point of strings within the input array. String array - Val. The source of string values to be joined. Int - First. The index of the first item in the array to be joined. Int - Count. The number of items, following the First, to be included in the Join. |
String representing the concatenation of the array (val) strings and the separation identifier (sep) including only the items in the val array starting with the First position and ending at the First + Count position.
|
LastIndexOf (1 param) |
Returns the index of the last position at which the match string is found. For example, if you are given the string, “The time has come” and set the match value to “me”, the result is: 15 as in “come” |
String - match. The string for which the match is sought. |
Int - Result is index number of the position at which the match string is located in the variable value. |
LastIndexOf (2 params) |
Returns the index of the last position at which the match string is found within a substring of the initial variable value comprised of the characters from index 0 to the start index. For example, if the string is: “The time has come” and the match value is “me”, a startindex of 15 returns index position 6 (as in “time”).
|
String - match. The string for which the match is sought. Int - startindex. The position in the string at which the search for the match ends. |
Int - the index of the position in the variable value at which the match is found.
|
LastIndexOf (3 params) |
Index method. Returns the index of the last position at which the match string is found within a substring of the initial variable value comprised of the characters ending with the start index and of length “count”. For example, if the string is: “The time has come” and the match value is “e”, given a startindex of 10 and count of 10, returns index position 7 (as in “time”). |
String - match. The string for which the match is sought. Int - startindex. The position in the string at which the search for the match ends. Count - The number of characters prior to the startindex from which the search substring is created. |
Int - the index of the position in the variable value at which the match is found.
|
PadLeft (1 param) |
This method right-aligns the characters in the string variable by inserting spaces in the beginning of the string (left) for the specified total width. |
Int - totalwidth. Sets the width of the resulting string. |
String result which is the original variable value with spaces added to the beginning of the string and resulting in a string of the length specified (totalwidth). |
PadRight (1 param) |
This method left-aligns the characters in the string variable by inserting spaces at the end of the string (right), for the specified total width. |
Int - totalwidth. Sets the width of the resulting string. |
String result which is the original variable value with spaces added to the end of the string and resulting in a string of the length specified (totalwidth). |
RegexReplace (2 params) |
This method replaces all occurrences of a character pattern defined by a regular expression (expression parameter) with a specified replacement character string (new value). For example, assume this string variable value: “For all good men.” With the replacement Expression: “good” and NewValue of “strong”, the result is: “For all strong men.” |
String - expression. The Regex string indicating the text in the variable value to match. String - NewValue. The text string to be inserted in the variable value in the place of the matching string. |
String - a new string in which the original variable value has been modified such that the matching characters are replaced by the NewValue string. |
RegexReplace (3 params) |
This method Replaces up to the specified number of occurrences (count) of a character pattern defined by a regular expression (expression parameter) with a specified replacement character string (new value). For example, assume this string variable value: “The time has come for all good men to come to the aid of their party.” With this replacement expression: come, NewValue of gone, and count of 1, the result is: “The time has gone for all good men to come to the aid of their party.” |
String - expression. The Regex string indicating the text in the variable value to match. String - NewValue. The text string to be inserted in the variable value in the place of the matching string. Int - Count. The number of matching occurrences to be replaced. |
String - a new string in which the original variable value has been modified such that the matching characters are replaced by the NewValue string.
|
RegexReplace (4 params) |
This method Replaces up to the specified number of occurrences (count) of a character pattern defined by a regular expression (expression parameter) with a specified replacement character string (new value) starting at a specified character position in the input string. For example, assume this string variable value: “The time has come for all good men to come to the aid of their party.” With this replacement expression: “come”, NewValue of “go”, and count of 1, and Startat value of 17 the result is: “The time has come for all good men to go to the aid of their party.” |
String - expression. The Regex string indicating the text in the variable value to match. String - NewValue. The text string to be inserted in the variable value in the place of the matching string. Int - Count. The number of matching occurrences to be replaced. Int - Startat. The position in the string from which the replacements can be made. |
String - a new string in which the original variable value has been modified such that the matching characters are replaced by the NewValue string.
|
Remove (1 param) |
Deletes characters from the variable value beginning at a specified position (startindex). |
Int - StartIndex. The position within the string from which characters are deleted from the string variable. |
String - result is the string variable after characters have been deleted.
|
Remove (2 params) |
Deletes a specified number of characters (count) from the variable value beginning at a specified position (StartIndex). |
Int - StartIndex. The position within the string from which characters are deleted from the string variable. Int - Count. The number of characters, beginning at the StartIndex, to delete. |
String - result is the string variable after characters have been deleted.
|
Replace (2 params) |
Replaces all occurrences of a specified string ( ) in the string variable with another string ( ). |
String - OldValue. The string to replace in the string variable. String - NewValue. The string to insert in the string variable in all places where the OldValue is displayed. |
String - result is a new string where the OldValue has been replaced with the NewValue.
|
Split (1 param) |
Creates a string array of substrings based on the string variable. The substrings are delineated with the specified character (Delim parameter). |
Character/string - a character or string of characters which delineate substrings in the string variable. |
String Array - result is a string array formed by substrings of the string variable.
|
Split (2 param) |
Creates a string array of substrings based on the string variable and the count parameter. The substrings are delineated with a specified character (Delim parameter). The total number of array elements to create is specified in the count parameter. |
Character/string - a character or string of characters which delineate substrings in the string variable. Int - Count. The total number of array elements to create from the string variable. |
A string array of elements comprised of substrings from the string variable.
|
StartsWith (1 param) |
Determines whether the beginning of the string variable matches the specified string parameter (match). |
String - match. The match parameter is a string to which the beginning of the string variable is compared. |
Boolean - result is True if the match parameter is identical to the beginning of the string variable.
|
Substring (1 param) |
Returns a substring from the string variable beginning at the position indicated by the startIndex parameter. |
Int - startIndex. The starting position in the string variable at which the substring is retrieved. |
String - result is a string retrieved from the string variable beginning at the startIndex parameter and including all subsequent character from the variable. |
Substring (2 param) |
Returns a substring from the string variable beginning at the position indicated by the startIndex parameter and includes subsequent characters until the specified length (length parameter) is reached. |
Int - startIndex. The starting position in the string variable at which the substring is retrieved. Int - length. The length of the substring to retrieve. |
String - result is a string retrieved from the string variable beginning at the start index and of a specified length.
|
ToLower |
Returns the string variable in lowercase characters. |
None |
String - equivalent to the string variable comprised of all lowercase characters. |
ToUpper |
Returns the string variable in uppercase characters. |
None |
String - equivalent to the string variable comprised of all uppercase characters. |
Trim |
Returns the string variable with any leading white spaces or trailing white spaces removed. |
None |
String - equivalent to the string variable with all leading and trailing white spaces removed. |
Related information
Privacy | Trademarks | Terms of Use | Feedback
Updated: 18 June 2020
© 2016 - 2020 Pegasystems Inc. Cambridge, MA All rights reserved.